import 'package:flutter/material.dart';

class BaseFilterSelectChip extends StatelessWidget {

  final bool selected;

  final String label;

  final ValueChanged<bool> onSelected;

  const BaseFilterSelectChip({Key key, @required this.selected, @required this.label, @required this.onSelected}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    Color primaryColor = Theme.of(context).primaryColor == Colors.white ? Theme.of(context).textTheme.bodyText2.color : Theme.of(context).primaryColor;
    Color backgroundColor = Color(0xFFF3F3F3);
    Color notSelectedText = Color(0xFF868686);
    return ChoiceChip(
      materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
      padding: EdgeInsets.all(0),
      label: Text(label, style: Theme.of(context).textTheme.bodyText2.copyWith(color: selected ? primaryColor : notSelectedText)),
      selected: selected,
      selectedColor: Colors.white,
      backgroundColor: backgroundColor,
      onSelected: onSelected,
      shape: RoundedRectangleBorder(
        borderRadius: BorderRadius.circular(3),
        side: BorderSide(width: 0.4, color: selected ? primaryColor : backgroundColor),
      ),
    );
  }

}
